import { observer } from 'mobx-react'
import styles from './index.module.less'
import store from '../../store'
import { resumeTypeMap } from '@/const'
import { formateMoney } from '@/utils'
import { RightOutline } from 'antd-mobile-icons'
import { history } from 'umi'

const Position = () => {
    const { fileDetail } = store || {}
    /** 跳转求职意向详情 */
    const gotoDetail = (id: string, index: number) => {
        history.push(`/position?id=${id}&number=${index + 1}`)
    }

    return (
        <div className={styles.wrapper}>
            <div className={styles.border_line} />
            <div className={styles.header}>求职意向</div>
            <div className={styles.content}>
                {fileDetail?.detail?.length > 0 &&
                    fileDetail?.detail?.map((item: any, index: number) => (
                        <div className={styles.resume_item} key={`${item?.code}${item?.capacityId}`} onClick={() => gotoDetail(item.id, index)}>
                            <div className={styles.resume_title}>
                                <p>
                                    [{item.cityName.replace(/(自治区|省|市|区)$/g, '')}]{item.capacityName} · {resumeTypeMap.get(Number(item.type))}
                                </p>
                                <RightOutline className={styles.right_icon} />
                            </div>
                            <div className={styles.resume_row}>
                                {formateMoney(item.minSalary)}-{formateMoney(item.maxSalary)}
                                <span className={styles.line} />
                                {item.industryName}
                            </div>
                        </div>
                    ))}
            </div>
        </div>
    )
}

export default observer(Position)
